<%-- 
    Document   : content
    Created on : Sep 21, 2012, 4:03:13 PM
    Author     : ChiTuan
--%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.pojo.CTDeal" %>
<%@page import="java.math.BigDecimal" %>
<%
    CTDeal ct =null;
    ArrayList<CTDeal> ds = null;
    ds = (ArrayList<CTDeal>)request.getAttribute("danhsachVoucher");
    int tongtrang = (Integer)request.getAttribute("TongTrang");
    int thanhpho=0;
%>
<script language="JavaScript">
    $(function(){
        var tp=$('#ChonThanhPho').val();
        $('#idthanhpho').val(tp);
    });
</script>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div class="timkiemmsanpham">
    <div class="tinhthanh">Chọn thành phố:
        
    </div>
    <div class="timkiem">
        <select id="ChonThanhPho">
            <option value="0">Hồ Chí Minh</option>
            <option value="1">Hà Nội </option>
        </select>
        <input id="idthanhpho" type="hidden" value="<%= thanhpho %>" />
    </div>

</div>
<div class="trang">
     <%  int trangtruoc = 1;
            if (request.getParameter("Trang") != null) {
                int tranghienhanh = Integer.parseInt(request.getParameter("Trang"));
                if (tranghienhanh > 1) {
                    trangtruoc = tranghienhanh - 1;
                }
            }
        %>
        <a  href="DSSanPhamcontroller?Trang=<%=trangtruoc %>" style="text-decoration: none;">[Trang trước]</a> Trang: <% 
        for(int i=1;i<=tongtrang;i++)
                       {%>
                       <a  href="DSSanPhamcontroller?Trang=<%=i %>" style="text-decoration: none;"><%= i %></a>
        <%}
        %>
        <%  int trangsau = trangtruoc+1;
                if (request.getParameter("Trang") != null) {
                    int tranghienhanh = Integer.parseInt(request.getParameter("Trang"));
                    if (trangsau <tongtrang) {
                        trangsau = tranghienhanh + 1;
                    }
                            }%>
        <a  href="DSSanPhamcontroller?Trang=<%=trangsau %>" style="text-decoration: none;">[Trang sau]</a>
</div>
<% if(ds.size()>=1){
                    for (int i =0;i<ds.size();i++){
                    ct = ds.get(i);
                %>
                
                <div class="deal">
                    <h3><%=ct.getTenDeal() %></h3>
                    <img src="<%=ct.getHinhAnh() %>" title="image <%=ct.getTenDeal() %>" />
                    <p><%=ct.getMota() %></p>
                    <div class="price">
                        <span class="title"><%=ct.getGiaGiam() %>VND</span>
                        <br/>Giá gốc :<span class="root-price"><%=ct.getGiaGoc() %></span>
                    </div>
                    <a class="button" href="detailcontroller?Idsanpham=<%=ct.getIdDeal() %>">Xem</a>
                    <div class="product-box">
                        <div class="product-bought">Phần Trăm Giảm <%=ct.getPhanTramGiam() %>%</div> 
                        <div class="product-save-percent">Số Người Mua <%=ct.getSoNguoiMua() %></div>
                        <div class="product-timeout">Thời gian </div>
                    </div>
                </div><%}}%>

